#ifndef DIST_CALCULATOR_H
#define DIST_CALCULATOR_H
#include "constants.h"
#include <cstdlib>

class DistCalculator2
{
public:
    DistCalculator2()
    {
        numOnes_[0] = 0;
        for(size_t i = 1; i < SIZE_VMSK; ++i) {
            numOnes_[i] = (i & 1) + numOnes_[i >> 1];
        }
    }

    unsigned char operator() (size_t a, size_t b) const
    {
        return numOnes_[a ^ b];
    }

private:
    unsigned char numOnes_[SIZE_VMSK];
};

const DistCalculator2 distanceCalculator;

#endif//DIST_CALCULATOR_H
